---
title: "Anthropic"
---

<Tabs>
  <Tab title="Python">
    **Change the api url and add a Helicone-Auth header**
    ```python
    import anthropic
    client = anthropic.Client(
        api_key="<Anthropic API Key>",
        base_url="https://anthropic.hconeai.com/v1"
    )
    res = client._request_as_json(
        "post",
        "v1/complete",
        params={
            "prompt": f"{anthropic.HUMAN_PROMPT} How many toes do dogs have?{anthropic.AI_PROMPT}",
            "stop_sequences": [anthropic.HUMAN_PROMPT],
            "model": "claude-v1",
            "max_tokens_to_sample": 300,
        },
        headers={
            "Helicone-Auth": "Bearer <HELICONE_API_KEY>"
        }
    )
    ```
  </Tab>

   <Tab title="Node (TS)">
    **Node (TS)**
    
    Change the api base and add a Helicone-Auth header
    ```typescript
  const anthropic = new Anthropic({
    baseURL: "https://anthropic.hconeai.com/",
    apiKey: "my api key",
    defaultHeaders: {
      "Helicone-Auth": "Bearer <HELICONE_API_KEY>",
    },
  });

const stream = await anthropic.completions.create({
prompt: `${Anthropic.HUMAN_PROMPT} Your prompt here${Anthropic.AI_PROMPT}`,
model: "claude-2",
stream: true,
max_tokens_to_sample: 300,
});

```

</Tab>
<Tab title="cURL">
  **Replace the Anthropic Base url with Helicone's**
```

- POST https://api.anthropic.com

* POST https://anthropic.hconeai.com

```

**Add a Helicone-Auth header into the requests**

```

"Helicone-Auth": "Bearer HELICONE_API_KEY"

```

Example cURL command

<Note>Please make sure to replace API keys with your own</Note>

```

curl --request POST \
 --url https://anthropic.hconeai.com/v1/complete \
 --header 'Content-Type: application/json' \
 --header 'Helicone-Auth: Bearer <<HELICONE_API_KEY>> \
 --header 'x-api-key: <<ANTHROPIC_API_KEY>> \
 --data '{
"prompt": "\n\nHuman: Tell me a haiku about trees\n\nAssistant:",
"model": "claude-v1-100k",
"max_tokens_to_sample": 300,
"stop_sequences": [
"\n\nHuman:"
]
}'

````

   </Tab>

   <Tab title="Langchain">
    **Python**

    Change the api base and add a Helicone-Auth header
    ```python
    anthropic = ChatAnthropic(
      temperature=0.9,
      model="claude-2",
      anthropic_api_url="https://anthropic.hconeai.com/",
      anthropic_api_key="ANTHROPIC_API_KEY",
      model_kwargs={
          "extra_headers":{
              "Helicone-Auth": f"Bearer {HELICONE_API_KEY}"
          }
      }
    )
    ```
    **Typescript**

    ```typescript
    const llm = new ChatAnthropic({
      modelName: "claude-2",
      anthropicApiKey: "ANTHROPIC_API_KEY",
      clientOptions: {
        baseURL: "https://anthropic.hconeai.com/",
        defaultHeaders: {
          "Helicone-Auth": `Bearer HELICONE_API_KEY`,
        }
      }
    });
    ```
  </Tab>
</Tabs>
````
